home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / Advanced I⁄O v2.3 / ANSI #includes addenda / minmax.h < prev    next >
Text File  |  1995-05-30  |  2KB  |  68 lines

  1. /*
  2. Copyright (C) 1992 Free Software Foundation
  3.     written by Doug Lea (dl@rocky.oswego.edu)
  4.  
  5. This file is part of the GNU C++ Library.  This library is free
  6. software; you can redistribute it and/or modify it under the terms of
  7. the GNU Library General Public License as published by the Free
  8. Software Foundation; either version 2 of the License, or (at your
  9. option) any later version.  This library is distributed in the hope
  10. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  11. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12. PURPOSE.  See the GNU Library General Public License for more details.
  13. You should have received a copy of the GNU Library General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17.  
  18. #ifndef _minmax_h
  19. #ifdef _GNUG_
  20. #pragma interface
  21. #endif
  22. #define _minmax_h 1
  23.  
  24. #ifdef _GNUG_
  25. #include <_G_config.h>
  26. #endif
  27.  
  28. inline char min(char a, char b) { return (a < b)?a:b;}
  29. #ifndef  _G_BROKEN_SIGNED_CHAR
  30. inline signed char min(signed char a, signed char b) { return (a < b)?a:b;}
  31. #endif
  32. inline unsigned char min(unsigned char a, unsigned char b) {return (a<b)?a:b;}
  33.  
  34. inline short min(short a, short b) {return (a < b) ?a:b;}
  35. inline unsigned short min(unsigned short a, unsigned short b) {return (a < b)?a:b;}
  36.  
  37. inline int min(int a, int b) {return (a < b)?a:b;}
  38. inline unsigned int min(unsigned int a, unsigned int b) {return (a < b)?a:b;}
  39.  
  40. inline long min(long a, long b) {return (a < b)?a:b;}
  41. inline unsigned long min(unsigned long a, unsigned long b) {return (a<b)?a:b;}
  42.  
  43. inline float min(float a, float b) {return (a < b)?a:b;}
  44.  
  45. inline double min(double a, double b) {return (a < b)?a:b;}
  46.  
  47. inline char max(char a, char b) { return (a > b)?a:b;}
  48. #ifndef  _G_BROKEN_SIGNED_CHAR
  49. inline signed char max(signed char a, signed char b) {return (a > b)?a:b;}
  50. #endif
  51. inline unsigned char max(unsigned char a, unsigned char b) {return (a>b)?a:b;}
  52.  
  53. inline short max(short a, short b) {return (a > b) ?a:b;}
  54. inline unsigned short max(unsigned short a, unsigned short b) {return (a > b)?a:b;}
  55.  
  56. inline int max(int a, int b) {return (a > b)?a:b;}
  57. inline unsigned int max(unsigned int a, unsigned int b) {return (a > b)?a:b;}
  58.  
  59. inline long max(long a, long b) {return (a > b)?a:b;}
  60. inline unsigned long max(unsigned long a, unsigned long b) {return (a>b)?a:b;}
  61.  
  62. inline float max(float a, float b) {return (a > b)?a:b;}
  63.  
  64. inline double max(double a, double b) {return (a > b)?a:b;}
  65.  
  66. #endif
  67.  
  68.